using System;
using System.Collections.Generic;
using System.Text;

namespace NBusiness.CodeDom
{
    /// <summary>
    /// An action defines what type of work a particular entity does. An action
    /// corresponds to a method implemented by a developer in an Entities corresponding
    /// code behind.
    /// </summary>
    /// <example>
    /// entity Employee
    /// {
    ///     action DoWork when Saved;
    /// }
    /// 
    /// /* Begin Code behind */
    /// using System;
    /// public partial class Employee
    /// {
    ///     public void Entity_Initialize()
    ///     {
    ///         //this would be generated automatically in the other part
    ///         this.Saved += new EventHandler&lt;PersistEventArgs&gt;(DoWork);
    ///     }
    /// 
    ///     // This would need to be created by a developer manually
    ///     public void DoWork(object sender, PersistEventArgs e)
    ///     {
    ///         //Do something interesting...
    ///     }
    /// }
    /// </example>
    [Serializable]
	public abstract class EntityAction : EntityCompileUnit, IInheritable
    {
        private string _name;
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        private string _on;
        public string On
        {
            get { return _on; }
            set { _on = value; }
        }

        private EntityActionType _when = EntityActionType.Never;
        public EntityActionType When
        {
            get { return _when; }
            set { _when = value; }
        }

        private bool _async;
        public bool Async
        {
            get { return _async; }
            set { _async = value; }
        }
	}
}
